package com.qing.expert.modules.expert.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qing.expert.modules.expert.entity.ExpertApply;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface ExpertApplyMapper extends BaseMapper<ExpertApply> {

    /**
     * 获取用户最新的申请状态
     * 
     * @param userId 用户ID
     * @return 申请状态：0=审核中，1=通过，2=拒绝
     */
    @Select("SELECT status FROM expert_apply WHERE user_id = #{userId} ORDER BY create_time DESC LIMIT 1")
    Integer getLatestApplyStatus(String userId);
}